package com.group.sliding.controller;

import com.group.sliding.annotation.CacheAddByUserId;
import com.group.sliding.constant.Constants;
import com.group.sliding.domain.vo.OrderLogisticsVO;
import com.group.sliding.result.Result;
import com.group.sliding.service.IOrderLogisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@Api(tags = "物流管理接口")
@RestController
@RequestMapping("/logistics")
@RequiredArgsConstructor
public class LogisticsController {
    private final IOrderLogisticsService orderLogisticsService;

    @ApiOperation("获取物流信息")
    @GetMapping("/list")
    @CacheAddByUserId(key = Constants.REDIS_KEY_LOGISTICS)
    public Result<List<OrderLogisticsVO>> queryMyLogistics(){
        log.info("查询物流信息列表");
        List<OrderLogisticsVO> logisticsVOS = orderLogisticsService.queryMyLogistics();
        log.info("查询物流信息列表成功 {}", logisticsVOS);
        return Result.success(logisticsVOS);
    }
}
